<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="Clases.domain.*" %>
<%@page import="pos.presentation.*" %>
<%@page import="java.util.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
		<script type="text/javascript" src="./../includes/funcionesJavaS.js"></script>
		<title>Registro</title>
		
	</head>
	<body>
		<%
			List barrios=ReciclajeStore.getInstance().getBarrios();
		%>
		<div id="formulario">
			<form id="formulario" action="./valida/validaRegistro.jsp" method="post">
			<div id="div_dat_pers">
				<div id=registro>Registro</div>
				
				<%  
							String barrioUs=request.getParameter("valor");
							String zonaUs=request.getParameter("valor1"); 
							
							out.print("barrioUs -->"+barrioUs+"    zonaUs-->"+zonaUs);
					%>
				
					<label id="label_barrio" for="barrio">Seleccion de barrio:</label>
					<select id= "idselect1" class="barrio" name="barrio" onchange="jumpTous('idselect1','idselect2','registro.jsp');">
						<%
							if(barrioUs==null){
								out.print("<Option selected>-</option>");
							}
							else{
								out.print("<Option selected>"+barrioUs+"</option>");
							}
							Iterator it=barrios.iterator();
							while(it.hasNext()){
								Barrio barrioAux=(Barrio)it.next();
								if(!barrioAux.getNombre().equals(barrioUs)){
									out.print("<option value=\""+barrioAux.getNombre()+"\">"+barrioAux.getNombre()+"</option>");
								}
							}
						%>
					</select>
					<div id="div_barrio">
					<label id="label_zona" for="zona">Seleccion de zona:</label>
					<select id= "idselect2" class="zona" name="zona" onchange="jumpToisbn('idselect1','idselect2','registro.jsp');">
						<%
							if(zonaUs==null){
								out.print("<Option selected>-</option>");
							}
							else{
								out.print("<Option selected>"+zonaUs+"</option>");							
							}
							Iterator it2=barrios.iterator();
							while(it2.hasNext()){
								Barrio barrioAux=(Barrio)it2.next();
								if(barrioAux.getNombre().equals(barrioUs)){
									Iterator it3=barrioAux.getZonas().iterator();
									while(it3.hasNext()){
										Zona zonaAux=(Zona)it3.next();
										if(!zonaAux.getNombre().equals(zonaUs)){
											out.print("<option value=\""+zonaAux.getNombre()+"\">"+zonaAux.getNombre()+"</option>");
										}
									}
								}
							}
						%>
					</select>
				</div>
				<div id="email">
					<label id="label_email" for="email">eMail:</label>
					<input id="email" name="email" type="text" title="Escriba su correo electronico"/>
				</div>
			
				<div id="nick">
					<label id="label_nick" for="nick">Nick:</label>
					<input id="nick" name="nick" type="text" title="Escriba su nick"/>
				</div>
				
				<div id="password">
					<label id="label_password" for="password">Clave:</label>
					<input id="password" name="password" type="password" title="Escriba su contraseña"/>
				</div>	
				<div id="preg1">
					<label id="label_preg1" for="preg1">Basura generada:</label>
					<input id="preg1" name="preg1" type="text" maxlength="3" title="Escriba cuantas bolsas de basura tira a la semana" />
				</div>
				
				<div id="reciclas">
	            	<div id="div_reciclas">
	                ¿Sueles reciclar?:
	              	</div>
				  	<div id="div_no">
	               		<input id="no" name="si_no" type="radio" value="no" checked="checked"/>
	                	<label id="label_no" for="no">No</label>
	             	</div>
			  
	             	<div id="div_si">
	              	  	<input id="si" name="si_no" type="radio" value="si"/>
	               		<label id="label_si" for="si">Si</label>
	             	</div>
           		</div>
			</div>
			<input id="a_registrar" type="submit" name="a_registrar" value="Siguiente"/>
		</form>
		</div>
	</body>
</html>